#include<iostream>
#include<cmath>
using namespace std;


void zero(int *p, int n) {
	p[n] = 0;
}

int main() {
	int array[100];
	int *p = array;
	int n =0;

	while (array[n - 1] != -1) {
		cin >> array[n];
		n++;
	}
	int sum ;
	cin >> sum;
	for (int i = 0; i < sum; i++) {
		zero( p, i );

	}
	for (int i = 0; i < n - 1; i++) {
		cout << array[i];
		if (i != n - 2) {
			cout << " ";
		}
	}

	return 0;
}
